<h2>Dette skjer de neste syv dager</h2>
<table class="core_index_calendar">
<?php $todaysDate = clone $this->today; ?>
<thead>
    <tr>
        <?php for ($i=0; $i < 7; $i++): ?>
            <th>
                <?php if ($todaysDate->isToday()): ?>
                    I dag
                <?php elseif($todaysDate->isTomorrow()): ?>
                    I morgen
                <?php else:
                    echo $todaysDate->get(Zend_Date::DATE_MEDIUM);
                endif; ?>
            </th>
            <?php $todaysDate->add(1, Zend_Date::DAY); ?>
        <?php endfor; ?>
    </tr>
</thead>
<tbody class="core_index_calendar_body">
    <?php $todaysDate = clone $this->today; ?>
    <tr>
        <?php for ($i=0; $i < 7; $i++): ?>
            <td>
            <?php foreach($this->events as $event):
            $from = new RedCross_Date();
            $from->import($event->from_date);
            $to = new RedCross_Date();
            $to->import($event->to_date);
            if(($from->isEarlier($todaysDate) || $from->equals($todaysDate, Zend_Date::DATE_MEDIUM)) && ($to->isLater($todaysDate) || $to->equals($todaysDate, Zend_Date::DATE_MEDIUM))): ?>
                <div class="<?php echo "core_index_calendar_" . strtolower($event->type);?>">
                <a href="<?php echo $this->url(array('module' => 'core', 'controller' => 'event', 'action' => 'view', 'id' => $event->id), null, true);?>" alt="Vis arrangement">
                    <?php echo $event->name;?></a>
            </div>
            <?php endif; ?>
        <?php endforeach; ?>
            </td>
            <?php $todaysDate->add(1, Zend_Date::DAY); ?>
        <?php endfor; ?>
    </tr>
</tbody>
</table>
<br />
